<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
//用户资金明细表
class Users_award_notice_model extends CI_Model{
    function __construct() {
        parent::__construct();
        $this->table = 'users_award_notice';
    }
    
    function get($id){
        return $this->db->where('id',$id)->get($this->table)->row_array();
    }
    
    function get_list($where,$page,$limit){
        $this->db->select("*");
        $this->db->from($this->table);
        $this->db->where($where);
        $this->db->order_by('create_time','desc');
        $this->db->limit($limit, $page);
        return $this->db->get()->result_array();
    }
    function get_count($where){
        $this->db->select('*');
        $this->db->from($this->table);
        $this->db->where($where);
        $this->db->order_by('create_time','desc');
        $query = $this->db->get();
        return $query->num_rows();
    }
    function insert($data){
        $this->db->insert($this->table, $data);
        if($this->db->affected_rows()){
            return $this->db->insert_id();
        }else{
            return 0;
        }
    }
    
    function update($data,$uid){
       return $this->db->where('id',$uid)->update($this->table, $data);
    }
    
    function update_all($data,$uid){
       return $this->db->where_in('id',$uid)->update($this->table, $data);
    }
}
